package npap.cater.unr.edu.client.managed.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.text.client.DateTimeFormatRenderer;
import com.google.gwt.text.shared.AbstractRenderer;
import com.google.gwt.text.shared.Renderer;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTMLPanel;
import java.util.HashSet;
import java.util.Set;
import npap.cater.unr.edu.client.proxy.ContactProxy;
import npap.cater.unr.edu.client.scaffold.place.AbstractProxyListView;

public class ContactListView extends ContactListView_Roo_Gwt {

    private static final Binder BINDER = GWT.create(Binder.class);

    private static npap.cater.unr.edu.client.managed.ui.ContactListView instance;

    /**
	 * @uml.property  name="newButton"
	 * @uml.associationEnd  readOnly="true"
	 */
    @UiField
    Button newButton;

    public ContactListView() {
        init(BINDER.createAndBindUi(this), table, newButton);
        table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
        init();
    }

    public static npap.cater.unr.edu.client.managed.ui.ContactListView instance() {
        if (instance == null) {
            instance = new ContactListView();
        }
        return instance;
    }

    public String[] getPaths() {
        return paths.toArray(new String[paths.size()]);
    }

    interface Binder extends UiBinder<HTMLPanel, ContactListView> {
    }
    
    public void init() {
//        paths.add("id");
//        table.addColumn(new TextColumn<ContactProxy>() {
//
//            Renderer<java.lang.Long> renderer = new AbstractRenderer<java.lang.Long>() {
//
//                public String render(java.lang.Long obj) {
//                    return obj == null ? "" : String.valueOf(obj);
//                }
//            };
//
//            @Override
//            public String getValue(ContactProxy object) {
//                return renderer.render(object.getId());
//            }
//        }, "Id");
        paths.add("firstname");
        table.addColumn(new TextColumn<ContactProxy>() {

            Renderer<java.lang.String> renderer = new AbstractRenderer<java.lang.String>() {

                public String render(java.lang.String obj) {
                    return obj == null ? "" : String.valueOf(obj);
                }
            };

            @Override
            public String getValue(ContactProxy object) {
                return renderer.render(object.getFirstname());
            }
        }, "First Name");
        paths.add("lastname");
        table.addColumn(new TextColumn<ContactProxy>() {

            Renderer<java.lang.String> renderer = new AbstractRenderer<java.lang.String>() {

                public String render(java.lang.String obj) {
                    return obj == null ? "" : String.valueOf(obj);
                }
            };

            @Override
            public String getValue(ContactProxy object) {
                return renderer.render(object.getLastname());
            }
        }, "Last Name");
        paths.add("organization");
        table.addColumn(new TextColumn<ContactProxy>() {

            Renderer<java.lang.String> renderer = new AbstractRenderer<java.lang.String>() {

                public String render(java.lang.String obj) {
                    return obj == null ? "" : String.valueOf(obj);
                }
            };

            @Override
            public String getValue(ContactProxy object) {
                return renderer.render(object.getOrganization());
            }
        }, "Organization");
        
    }
}
